#!/bin/bash
read -p "用户名：" username
read -p "密码：" mysqlpassword
mysqlIO=$(mysql -u${username} -p${mysqlpassword} -e "show slave status\G;" 2> /dev/null | head -n 12 | tail -n 1 | awk '{print $2}')
mysqlSQL=$(mysql -u${username} -p${mysqlpassword} -e "show slave status\G;" 2> /dev/null | head -n 13 | tail -n 1 | awk '{print $2}')

if [ "$mysqlIO" == "Yes" ]; then
    echo "IO：1"
else
    echo "IO：0"
fi
if [ "$mysqlSQL" == "Yes" ]; then
    echo "SQL：1"
else
    echo "SQL：0"
fi

